package com.leo.apptest.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.leo.apptest.R;
import com.leo.apptest.model.Person;

public class ParcelableSendActivity extends AppCompatActivity {

    private Button mBtSend;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_parcelable);
        mBtSend = (Button) findViewById(R.id.btSend);
        final Person p = new Person();
        p.setName("leo");
        p.setId(20);
        mBtSend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(ParcelableSendActivity.this,ParcelableGetActivity.class);
                intent.putExtra("person",p);
                startActivity(intent);
            }
        });

    }
}
